/**
 *
 * @author Sara Pulis
 */

public class BinTree {

    private String label = null;
    private BinTree leftKid = null;
    private BinTree rightKid = null;
    private static BinTree currentRoot;

    public BinTree() {
        currentRoot = this;
    }

    public BinTree(String theLabel) {
        label = theLabel;
        currentRoot = this;
    }

    public void setLabel(String theLabel) {
        label = theLabel;
    }

    public String getLabel() {
        return label;
    }

    public void addRightKid() {
        rightKid = new BinTree();
    }

    public void addLeftKid() {
        leftKid = new BinTree();
    }

    public void addRightKid(String theLabel) {
        rightKid = new BinTree(theLabel);
    }
    
    public void addLeftKid(String theLabel) {
        leftKid = new BinTree(theLabel);
    }

    public boolean hasLeftKid() {
        if (leftKid != null) {
            return true;
        } else {
            return false;
        }
    }

    public boolean hasRightKid() {
        if (rightKid != null) {
            return true;
        } else {
            return false;
        }
    }

    public BinTree getLeftKid() {
        return leftKid;
    }

    public BinTree getRightKid() {
        return rightKid;
    }

    public BinTree getCurrentRoot() {
        return this;
    }

    public void setCurrentRoot(BinTree root) {
        currentRoot = root;
    }

}
